package com.example.a79273.shandianban.application;

import android.app.Activity;
import android.app.Application;
import android.graphics.Bitmap;

import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 79273 on 2016/8/29.
 */
public class MyApplication extends Application {

    private static MyApplication application;
    private List<Activity> activities = new ArrayList<>();
    private boolean isLogin;

    public boolean isLogin() {
        return isLogin;
    }

    public void setLogin(boolean login) {
        isLogin = login;
    }
    private String name;
    private Bitmap icon;

    public void setIcon(Bitmap icon) {
        this.icon = icon;
    }

    public Bitmap getIcon() {
        return icon;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getName() {
        return name;
    }


    @Override
    public void onCreate() {
        super.onCreate();
        x.Ext.init(this);

    }

    @Override
    public void onTerminate() {
        super.onTerminate();
    }

    public static MyApplication getInstance() {
        if (application == null) {
            application = new MyApplication();
        }
        return application;
    }


    /*处理不规范的字符串的方法*/
    public static String dealWithString(String result) {
        int startIndex = result.indexOf("{");
        int endIndex = result.lastIndexOf("}");
        return result.substring(startIndex, endIndex + 1);
    }
}
